package controller

import (
	"StrayAnimals/internal/service"
	"github.com/gin-gonic/gin"
)

func GetHistoryAvatar(c *gin.Context) {
	// 从网址参数中获取用户id
	userID := c.Query("id")

	if userID == "" {
		c.JSON(400, gin.H{
			"code":    400,
			"message": "用户id为空，无法获取历史头像",
		})
		return
	}

	result, err := service.GetHistoryAvatar(userID)
	if err != nil {
		c.JSON(500, gin.H{
			"code":    500,
			"message": "系统错误，获取历史头像失败，请稍后再试；" + err.Error(),
		})
		return
	}

	c.JSON(200, gin.H{
		"code": 200,
		"data": result,
	})
}
